<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Simple Javascript Scroll Animation</title>
  <link rel="stylesheet" href="index.css">
</head>

<body>
  <section>
    <div class="slide" id="slide1"></div>
    <div class="slide" id="slide2"></div>
  </section>
  <h2>Simple Javascript Scroll Animation</h2>
</body>
<script>
  let slide1 = document.getElementById('slide1')
  let slide2 = document.getElementById('slide2')

  window.addEventListener('scroll', () => {
    slide1.style.left = window.pageYOffset + 'px'
    slide2.style.left = -window.pageYOffset + 'px'
  })
</script>

</html>